﻿@using ENail.Domain.Core
@using Equation.Enterprise.Framework.Web.Model
@using ENail.Portal.Web.Models
@using MvcContrib.UI.Pager
@using MvcContrib.UI.Grid 
@using MvcContrib.Pagination 
@model GenericListViewModel<RegistrationListViewItem>

@{
    ViewBag.Title = "Billing List";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script language="javascript">
    //payment and print receipt
    function payment(id) {
            var url = '/Billing/Close/' + id ;
        alert(url);
            location.href = url;
    }
</script>
<div id="container_home_main" >
<div style="background-color:#edd2ca;width:645px;height:15px;text-align:center;padding:5px"> <font style="color:#5b362c;font-weight:bold">@ViewBag.Title</font> </div>
<div id="container_content">

    @using (Html.BeginForm())
    {
    <table>
        <tr>
            <td align="right" width="150px">Customer Name:</td>
            <td>@Html.TextBoxFor(x => x.Filter)</td>
            <td><input type="submit" value="Search" /></td>
        </tr>
    </table>

    <table>
        @*<tr>
            <td align="right">
                @Html.Pager((IPagination)Model.List).Link(page => Url.Action("List", new { page = page, filter = Model.Filter }))
            </td>
        </tr>*@
        <tr>
            <td>
                @Html.Grid(Model.List).Columns((column) =>
                                                {
                                                    //column.For(x => Html.CheckBox("chkIsSelected", x.IsSelected))
                                                    //        .Named("");
                                                    column.For(x => x.CustomerName)
                                                            .Named("Customer Name")
                                                            .Attributes(width => "250px");
                                                    column.For(x => x.Status)
                                                            .Named("Status")
                                                            .Attributes(width => "110px");
                                                    column.For(x => x.StartTime)
                                                            .Named("Start Time")
                                                            .Attributes(width => "100px")
                                                            .Format("{0:HH:mm}");
                                                    column.For(x => Html.ActionLink("View Receipt", "Update", new { id = x.Id }))
                                                            .Attributes(width => "110px");
                                                    //column.For(x => Html.ActionLink("Edit Assignment", "Index", "Assignment", new { id = x.Id }, null))
                                                    //        .Attributes(width => "130px");
                                                    column.For(x => x.Status != Status.Closed ? "<button onclick='payment(" + x.Id + ")'>Payment</button>" : "").Encode(false);

                                                }
                                        ).Attributes(@class => "grid"
                                        ).HeaderRowAttributes(new Dictionary<string, object> { { "class", "gridheaderrow" } }
                                        )

            </td>
        </tr>
        <tr>
            <td align="right">

            </td>
        </tr>
    </table>
    }
        </div>
	      </div>
          <div id="container_home_right">@{
            Html.RenderAction("InitializeTask");   
        }
</div>
